package com.victor.service.impl;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.victor.dao.PictureStaticDao;
import com.victor.entity.PictureStatic;
import com.victor.service.PictureStaticService;

@Service
@Transactional
public class PictureStaticServiceImpl implements PictureStaticService {

	@Autowired
	private PictureStaticDao dao;

	@Override
	public boolean insert(PictureStatic p) {
		PictureStatic temp = dao.findByUserIdAndPicId(p.getSUserId(), p.getSPicId());
		boolean bool = true;
		if (temp == null) {
			bool = dao.insert(p) > 0 ? true : false;
		} else {
			p.setSId(temp.getSId());
			bool = dao.update(p) > 0 ? true : false;
		}
		return bool;
	}

	@Override
	public boolean updateYD(int[] ids) {
		return dao.updateYD(ids) >= 0 ? true : false;
	}

	@Override
	public boolean updatebookcase(int[] ids) {
		return dao.updatebookcase(ids) >= 0 ? true : false;
	}

}
